import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useMemberStore = defineStore(
    'member',
    () => {
        //会员信息
        const profile = ref<any>()

        const setProfile = (val: any) => {
            profile.value = val
        }

        const clearProfile = () => {
            profile.value = undefined
        }

        return {
            profile,
            setProfile,
            clearProfile
        }
    },
    {
        persist: {
            storage: {
                setItem(key, value) {
                    uni.setStorageSync(key, value)
                },
                getItem(key) {
                    return uni.getStorageSync(key)
                }
            }
        }
    }
)